﻿using Apps.Common;
using Apps.DAL.YANX;
using Apps.IBLL.HuaChan;
using Apps.IBLL.YANX;
using Apps.Models;
using Apps.Models.HuaChan;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Runtime.InteropServices.ComTypes;
using System.Text;
using System.Threading.Tasks;

namespace Apps.BLL.HuaChan
{
    public partial class HUACHAN_BLL : IHUACHAN_BLL
    {
        HUACHAN_Repository dal = new HUACHAN_Repository();

        /// <summary>
        /// 获取化产项目详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public HUACHAN_PROJECT ProjectInfo(string id)
        {
            return dal.Info(id);
        }

        /// <summary>
        /// 查询标题是否存在
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool ProjectAny(string name, string id = "")
        {
            return dal.ProjectAny(name, id);
        }

        /// <summary>
        /// 获取化产项目列表
        /// </summary>
        /// <returns></returns>
        public List<HUACHAN_PROJECT> ProjectList(int pageIndex, int pageSize, string sort, string order, ref int totalCount, string keyWord)
        {
            return dal.GetList(pageIndex, pageSize, ref totalCount, sort, order, keyWord);
        }

        public List<HUACHAN_PROJECT> GetNopageList(string keyWord)
        {
            return dal.GetNopageList(keyWord);
        }

        /// <summary>
        /// 添加化产项目
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool ProjecAdd(HUACHAN_PROJECT model)
        {
            return dal.Add(model);
        }

        /// <summary>
        /// 修改化产项目
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool ProjectEdit(HUACHAN_PROJECT model)
        {
            return dal.Update(model);
        }

        /// <summary>
        /// 删除化产项目
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool ProjectDelete(string id)
        {
            return dal.Delete(id);
        }

        /// <summary>
        /// 获取此化产项目包含的字段
        /// </summary>
        /// <param name="projectId"></param>
        /// <returns></returns>
        public List<HUACHAN_PROJECT_FIELDS> GetListDetail(string projectId)
        {
            return dal.GetListDetail(projectId);
        }

        /// <summary>
        /// 根据化产表单获取化产数据
        /// </summary>
        /// <param name="projectId"></param>
        /// <returns></returns>
        public List<HUACHAN_PROJECT_DATA> GetProjectData(int pageIndex, int pageSize, ref int totalCount, string sortFiled, string orderBy, string examine, string projectId,string startTime,string endTime)
        {
            return dal.GetProjectData(pageIndex, pageSize, ref totalCount, sortFiled, orderBy, examine, projectId, startTime, endTime);
        }

        /// <summary>
        /// 根据化产表单获取化产数据
        /// </summary>
        /// <param name="projectId"></param>
        /// <returns></returns>
        public List<HUACHAN_PROJECT_DATA> GetProjectData(string sortFiled, string orderBy, string examine, string projectId, string startTime, string endTime)
        {
            return dal.GetProjectData(sortFiled, orderBy, examine, projectId, startTime, endTime);
        }

        /// <summary>
        /// 添加化产表单数据
        /// </summary>
        /// <param name="projectId"></param>
        /// <returns></returns>
        public bool AddProjectData(HUACHAN_PROJECT_DATA model)
        {
            return dal.AddProjectData(model);
        }

        /// <summary>
        /// 编辑化产表单数据
        /// </summary>
        /// <param name="projectId"></param>
        /// <returns></returns>
        public bool UpdateProjectData(HUACHAN_PROJECT_DATA model)
        {
            return dal.UpdateProjectData(model);
        }

        /// <summary>
        /// 删除化产表单数据
        /// </summary>
        /// <param name="projectId"></param>
        /// <returns></returns>
        public bool DelProjectData(string dataId)
        {
            return dal.DelProjectData(dataId);
        }

        /// <summary>
        /// 根据编号获取 数据
        /// </summary>
        /// <param name="dataId"></param>
        /// <returns></returns>
        public HUACHAN_PROJECT_DATA GetProjectData(string dataId)
        {
            return dal.GetProjectData(dataId);
        }

        /// <summary>
        /// 判断此项目是否存在记录
        /// </summary>
        /// <param name="dataId"></param>
        /// <returns></returns>
        public bool ThisProjectIsAnyData(string projetId)
        {
            return dal.ThisProjectIsAnyData(projetId);
        }

        /// <summary>
        /// 根据编号获取 数据
        /// </summary>
        /// <param name="dataId"></param>
        /// <returns></returns>
        public DataTable GetProjectDataTable(string dataId)
        {
            return dal.GetProjectDataTable(dataId);
        }

        /// <summary>
        /// 批量审核
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="examine"></param>
        /// <returns></returns>
        public bool ExamineProjectData(List<string> ids, string examine)
        {
            return dal.ExamineProjectData(ids, examine);
        }

        /// <summary>
        /// 根据条件查询所有数据
        /// </summary>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <param name="isExamine"></param>
        /// <returns></returns>
        public List<HUACHAN_PROJECT_DATA> GetAllData(string startDate, string endDate, string isExamine)
        {
            return dal.GetAllData(startDate, endDate, isExamine);
        }

        /// <summary>
        /// 根据条件查询所有项目
        /// </summary>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <param name="isExamine"></param>
        /// <returns></returns>
        public List<HUACHAN_PROJECT> GetAllProject()
        {
            return dal.GetAllProject();
        }

        /// <summary>
        /// 根据条件查询所有配置项
        /// </summary>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <param name="isExamine"></param>
        /// <returns></returns>
        public List<HUACHAN_PROJECT_FIELDS> GetAllFields()
        {
            return dal.GetAllFields();
        }
    }
}
